unit unDetalhePontuacao;

interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, Grids, DBGrids, ThemeDBGrid, DB, StdCtrls, Buttons, ComCtrls;

type
 TfmDetalhePontuacao = class(TForm)
  dsDetalhesPontuacao: TDataSource;
  btFechar: TBitBtn;
  PageControl1: TPageControl;
  TabSheet1: TTabSheet;
  ThemeDBGrid1: TThemeDBGrid;
  procedure btFecharClick(Sender: TObject);
  procedure FormKeyPress(Sender: TObject; var Key: Char);
  procedure ThemeDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
   DataCol: Integer; Column: TColumn; State: TGridDrawState);
    procedure ThemeDBGrid1DblClick(Sender: TObject);
 private
    { Private declarations }
 public
    { Public declarations }
 end;
 
var
 fmDetalhePontuacao: TfmDetalhePontuacao;
 
implementation

uses unDM, unResultados;

{$R *.dfm}

procedure TfmDetalhePontuacao.btFecharClick(Sender: TObject);
begin
 Close
end;

procedure TfmDetalhePontuacao.FormKeyPress(Sender: TObject; var Key: Char);
begin
 if key = #27 then
  Close;
end;

procedure TfmDetalhePontuacao.ThemeDBGrid1DblClick(Sender: TObject);
begin
fmResultados := TfmResultados.Create(Self);
fmResultados.btSalvar.Visible := False;
fmResultados.btCancelarEvento.Visible := False;
dm.tabEventos.Open;
dm.tabEventos.Locate('idevento',dm.tabDetalhePontuacaoidevento.Value,[]);
fmResultados.TabSheet1.Caption := dm.tabEventosEvento.Value;
fmResultados.ShowModal;
dm.tabEventos.Close;
fmResultados.Free;
end;

procedure TfmDetalhePontuacao.ThemeDBGrid1DrawColumnCell(Sender: TObject;
 const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
 
 if (dm.tabDetalhePontuacaoPosicao.Value = 1) and (Column.Field = dm.tabDetalhePontuacaoPosicao) then
  ThemeDBGrid1.Canvas.Font.Style := ThemeDBGrid1.Canvas.Font.Style + [fsBold];
 
 if (dm.tabDetalhePontuacao.RecNo mod 2) = 0 then
  if ThemeDBGrid1.Canvas.Brush.Color = ThemeDBGrid1.Color then
   ThemeDBGrid1.Canvas.Brush.Color := clMoneyGreen;
 
 ThemeDBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;

end.

